package com.hgw.Demo08_StatePattern.Exercises23_8_4;

/**
 * Data time:2021/12/20 17:22
 * StudentID:2019112118
 * Author:hgw
 * Description: 门，环境类
 */
public class Door {
    private DoorState state;

    public DoorState CLOSED,OPENING,OPEN,CLOSING,STAYOPEN;

    public void setState(DoorState state) {
        this.state = state;
        CLOSED = new DoorClosed(this);
        OPENING = new DoorOpening(this);
        OPEN = new DoorOpen(this);
        CLOSING = new DoorClosing(this);
        STAYOPEN = new DoorStayOpen(this);
    }

    // 单击
    public void click() {
        state.click();
    }
    // 超时
    public void timeout() {
        state.timeout();
    }
    // 完成
    public void complete() {
        state.complete();
    }
}
